﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace InputProductForm
{
    class TMaterial
    {
        UTLDB.UTLDB _cn = new UTLDB.UTLDB();
        public DataTable GetMaterial()
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("usp_SelecttblMaterial");
            return data;
        }
        public int Insert(Info.InfoMaterial info)
        {

            int id = _cn.ExecuteInsert("usp_InserttblMaterial",
               new string[] { "@Name", "@Price", "@Active" },
               new object[] { info.Name, info.Price,  info.Active });
            return id;
        }
        public void Update(Info.InfoMaterial info)
        {
            int id = _cn.ExecuteNonQuery("usp_UpdatetblMaterial",
                  new string[] { "@ID", "@Name", "@Price", "@Active" },
                  new object[] { info.ID, info.Name, info.Price, info.Active });

        } 
    }
}
